package com.designPattern.FactoryMode;

/**
 * Created by Administrator on 2018/1/2.
 */

public class OperationFactory {
    public static Operation createOperation(String operater) {
        Operation oper = null;
        switch (operater) {
            case "+":
                oper = new OperationAdd();
                break;
            case "-":
                oper = new OperationSub();
                break;
            case "*":
                oper = new OperationMul();
                break;
            case "/":
                oper = new OperationDiv();
                break;
            default:
                System.out.println("请输入正确的运算符！");
                break;
        }
        return oper;
    }
}
